package com.songjiakang.dao;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.songjiakang.entity.Drom;
import com.songjiakang.entity.Floor;
import com.songjiakang.entity.Record;
import com.songjiakang.entity.Student;

public interface DromDao {
	@Select("select * from t_student where name=#{name} and password=#{password}")
	Student login(Student student);
	@Select("SELECT c.drom_no,d.floor_no,a.start_time,a.end_time from t_record a LEFT JOIN t_student b on a.student_id=b.id LEFT JOIN t_drom c on c.id=a.dorm_id LEFT JOIN t_floor d on c.floor_id =d.id  where b.id=#{id}")
	List<Record> list0(Student student);
	
	List<Record> list1(@Param("hao")String hao,@Param("name") String name);
	@Select("SELECT floor_no,drom_no,COUNT(a.id) countren FROM t_drom a LEFT JOIN t_floor b on a.floor_id=b.id LEFT JOIN t_record c on c.dorm_id =a.id where end_time is NULL and a.id=#{id}")
	Record shang(Integer id);
	@Select("SELECT d.id,d.`name`,b.start_time,b.end_time from t_drom a LEFT JOIN t_record b on a.id=b.dorm_id LEFT JOIN t_floor c on a.floor_id=c.id LEFT JOIN t_student d on b.student_id=d.id where a.id=#{id}")
	List<Record> xia(Integer id);
	@Select("select * from t_student  a LEFT JOIN t_record b on a.id=b.student_id where b.end_time IS NULL ")
	List<Student> getstudent();
	@Select("select * from t_floor")
	List<Floor> floor();
	@Select("select * from t_drom where floor_id=#{id}")
	List<Drom> drom(Integer id);

}
